//
//  ProjectDetailView.m
//  RNIbuildModuleBaiduMap
//
//  Created by Wentao Ye on 19/05/2017.
//  Copyright © 2017 Facebook. All rights reserved.
//

#import "ProjectDetailView.h"

@implementation ProjectDetailView

-(instancetype)init{
    self = [super init];
    if (self) {
        
    }
    return  self;
}

-(id)initWithFrame:(CGRect)frame
{
    if ((self = [super initWithFrame:frame])) {
        
        self.backgroundColor = [UIColor whiteColor];
        [self setUserInteractionEnabled:YES];
        
        self.imgProjectImage = [[UIImageView alloc] initWithFrame:CGRectMake(5.f, 0, 50, 50)];
        self.imgProjectImage.backgroundColor = [UIColor clearColor];
        self.imgProjectImage.layer.borderWidth = 0.f;
        self.imgProjectImage.layer.borderColor = [[UIColor grayColor] CGColor];
        [self addSubview:self.imgProjectImage];
        
        
        self.lblProjectName = [[UILabel alloc] initWithFrame:CGRectMake(60.f, 0.f , frame.size.width - 65.f, 50.f)];
        self.lblProjectName.backgroundColor = [UIColor clearColor];
        self.lblProjectName.numberOfLines = 100;
        self.lblProjectName.font = [UIFont systemFontOfSize:10.f];
        self.lblProjectName.textColor = [UIColor blackColor];
        self.lblProjectName.textAlignment = NSTextAlignmentLeft;
        self.lblProjectName.lineBreakMode = NSLineBreakByWordWrapping;
        [self addSubview:self.lblProjectName];
        [self.lblProjectName setUserInteractionEnabled:YES];
        
        UITapGestureRecognizer *tapRecg = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
        [self.lblProjectName addGestureRecognizer:tapRecg];
        
    }
    return self;
}

-(void) bindProjects:(BDMapAnnotation *)info{
    //    self.projectInfo = info;
    //    self.lblProjectName.text  = info.projectName;
    //
    //    NSURL *imageUrl = [NSURL URLWithString:info.projectImage];
    //    UIImage *pImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageUrl]];
    //    self.imgProjectImage.image = pImage;
    
}


-(void)viewTapped:(UITapGestureRecognizer *)sender
{
    [self.delegate ProjectDetailView:self clickViewWithData:self.projectInfo];
}
@end
